var layset= {icon: 7,area:'500px',title:'提示',skin: 'jm-class'};
var zskfx=0;
// 兼容IE
if(!Element.prototype.matches) {
	Element.prototype.matches =
		Element.prototype.matchesSelector ||
		Element.prototype.mozMatchesSelector ||
		Element.prototype.msMatchesSelector ||
		Element.prototype.oMatchesSelector ||
		Element.prototype.webkitMatchesSelector ||
		function (s) {
			var matches = (this.document || this.ownerDocument).querySelectorAll(s),
				i = matches.length;
			while (--i >= 0 && matches.item(i) !== this) {
			}
			return i > -1;
		};
}

// 引入JS/CSS  $.include(["/js/a.js"]);
if(typeof ossurl==="undefined"){
	var js = document.scripts;
	js = js[js.length - 1].src.substring(0, js[js.length - 1].src.lastIndexOf("/"));
	var ossurl = js.substring(0, js.lastIndexOf("/"));
}
$.extend({
	includePath: ossurl,
	include: function(K) {
		var N = typeof K == "string" ? [K] : K;
		for (var T = 0; T < N.length; T++) {
			var M = N[T].replace(/^\s|\s$/g, "");
			var R = M.split(".");
			var L = R[R.length - 1].toLowerCase();
			var P = L == "css";
			var O = P ? "link" : "script";
			var S = P ? " type='text/css' rel='stylesheet' disabled='true' " : " language='javascript' type='text/javascript' ";
			var Q = (P ? "href" : "src") + "='" + $.includePath + M + "'";
			if ($(O + "[" + Q + "]").length == 0) {
				document.write("<" + O + S + Q + "></" + O + ">")
			}
		}
	}
});
$.include(["/js/layer.js","/js/md5.js"]);


//cookie
function set_c(C, D,h) {
	exp = new Date();
	exp.setTime(exp.getTime() + (3600 * 1000 * h));
	document.cookie = C + "=" + escape(D) + "; expires=" + exp.toGMTString() + "; path=/"
}

function get_c(C) {
	var D;
	D = C + "=";
	offset = document.cookie.indexOf(D);
	if (offset != -1) {
		offset += D.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1) {
			end = document.cookie.length
		};
		return unescape(document.cookie.substring(offset, end))
	} else {
		return ""
	}
}

function del_c(B) {
	exp = new Date();
	exp.setTime(exp.getTime() - 10000000);
	document.cookie = B + "=" + null + "; expires=" + exp.toGMTString() + "; path=/"
}

//域名
function isym(str){
	str=str.toLowerCase();
	var hz = '.com,.net,.org,.biz,.info,.name,.mobi,.tel,.xxx,.ac,.ag,.am,.asia,.at,.co,.be,.bz,.ca,.cc,.ch,.cm,.cx,.cz,.de,.ac.cn,.bj.cn,.sh.cn,.tj.cn,.cq.cn,.he.cn,.sx.cn,.nm.cn,.ln.cn,.jl.cn,.hl.cn,.js.cn,.zj.cn,.ah.cn,.fj.cn,.jx.cn,.sd.cn,.ha.cn,.hb.cn,.hn.cn,.gd.cn,.gx.cn,.hi.cn,.sc.cn,.gz.cn,.yn.cn,.xz.cn,.gs.cn,.qh.cn,.nx.cn,.xj.cn,.tw.cn,.mo.cn,.com.cn,.net.cn,.sn.cn,.org.cn,.hk.vc,.hk.cn,.sale,.wang,.xyz,.pro,.xin,.app,.vip,.top,.cn,.tv,.hk,.ng,.la,.in,.pw,.sx,.me,.gg,.gs,.st,.us,.dk,.ec,.es,.eu,.fm,.fr,.gd,.gl,.gr,.gy,.hn,.ht,.im,.io,.it,.je,.jp,.ki,.lc,.li,.lu,.lv,.md,.mg,.mn,.ms,.mu,.mx,.my,.nl,.nu,.pe,.ph,.pl,.pm,.se,.sh,.so,.tc,.tf,.tk,.tl,.tm,.to,.tw,.co.uk,.uk,.vc,.vg,.wf,.ws,.yt,.ltd,.men,.bid,.fi,.lt,.games,.news,.work,.space,.win,.link,.store,.co.jp,.edu,.ren,.date,.site,.red,.kim,.cn.com,.club,.gp,.is,.pt,.one,.tt,.ai,.ma,.ee,.su,.run,.car,.fish';
	hz = hz.split(",");
	var qm = str.substr(0,str.indexOf("\."));
	var hm = str.substr(str.indexOf("\."));
	return str.length>0 && $.inArray(hm, hz)>=0 && qm.match(/^[a-z0-9\u4e00-\u9fa5]+([a-z0-9\u4e00-\u9fa5-]*(?:[a-z0-9\u4e00-\u9fa5]+))?$/i) ? true : false;
}

//过滤文本
function glwb(s) {
	if(typeof s==="undefined"){return '';}
	var a_nr = s;
	var re = new RegExp('"', "g");
	a_nr = a_nr.replace(re, "&#34;");
	var re = new RegExp("'", "g");
	a_nr = a_nr.replace(re, "&#39;");
	var re = new RegExp('<', "g");
	a_nr = a_nr.replace(re, "&#60;");
	var re = new RegExp('>', "g");
	a_nr = a_nr.replace(re, "&#62;");
	return a_nr
}

//输出文本
function daochu(E) {
	if (E != "") {
		var F = window.open("", "", "");
		F.opener = null;
		F.document.write(E);
		F.document.close()
	}
}

//.替换为/
function thym(ym){
	return ym.replace(/\./g,"/").toLowerCase();
}
//替换.为_
function thym2(ym){
	return ym.replace(/\./g,"_").toLowerCase();
}

//页面滚动
function gd(wz,s,x) {
	if(typeof(s) === "undefined"){
		var s=200;
	}
	if (wz>=0) {
		$("html,body").animate({scrollTop: wz},s);
	} else {
		if($(wz).length>0){
			var gd=$(wz).offset().top
			if(x){
				gd=gd+x;
			}
			$("html,body").animate({scrollTop: gd},s);
		}
	}
}

//登录框
function login(){
	layer.closeAll();
	layer.open({
		type: 1,
		skin: 'jm-class',
		shadeClose: true,
		title: '用户登录',
		area: ['360px', '340px'], //宽高
		content: '<div id="pop-login"><div><input id="re_yx" class="jm-input" name="re_yx" type="text" autocomplete="off" placeholder="请输入您的邮箱/ID" required="required"><i class="iconfont">&#xe669;</i></div><div><input id="re_mm" class="jm-input" name="re_mm" autocomplete="off" type="password" placeholder="请输入您的密码" required="required"><i class="iconfont">&#xe681;</i></div><div><input id="re_yzmx" class="jm-input" name="re_yzm" autocomplete="off" placeholder="请输入验证码" required="required" type="text" max-length="4"><img class="buttonss" id="re_yzmsx" title="看不清？点一下换图" src="/xcode" onclick="this.src=\'/xcode?\'+new Date().getTime();" align="absmiddle"><i class="iconfont">&#xe67b;</i></div><div class="submit-box"><button type="button" class="jm-button">登录</button><div><a href="/reg.htm" target="_blank" class="reg-link">新用户注册</a><a href="/getpass.htm" target="_blank" class="reg-link fr">忘记密码？</a></div></div></div>',
		success: function () {
			$(".jm-class .cancel-btn").click(function () {
				layer.closeAll();
			});
			$(".submit-box button").click(function () {
				loginSubmit();
			});

			$("#pop-login input").keyup(function(e) {
				if (e.keyCode  == 13) {
					loginSubmit();
				}
			});
		}
	});
}

//登录提交
function loginSubmit() {
	if (!yz("pop-login")) {
		return false;
	}
	var re_mm = $.md5($.md5('[jiami' + glwb($("#re_mm").val()) + 'mima]').substring(0, 19)).substring(0, 19);
	var data = {
		re_mm: re_mm,
		re_yx: $("#re_yx").val(),
		re_yzm: $("#re_yzmx").val(),
	};
	$.ajax({
		url: '/user_zh/p_login',
		dataType: 'json',
		type: 'post',
		data: data,
		success: function (res) {
			if (res.code === 1) {
				dlzt('dl');
				layer.closeAll();
				layer.msg(res.msg);
				
			} else {
				layer.msg(res.msg);
				$("#re_yzmsx").click();
				$("#re_yzmx").val('');
			}
		}
	});
}

//登录状态
function dlzt(fs) {
	$.ajax({
		type: "GET",
		url: "/user_zh/islogin",
		dataType: "json",
		cache: false,
		success: function (re) {
			uid=re.uid;
			ishy=re.ishy;
			isdl=re.isdl;
			$("#loginx").html(re.data);
			if(fs=='dl'){
				zskfx=0;
				try {
					if(typeof dl_call === "function") {
						dl_call();
					}
				} catch(e) {}
			}
			else if(fs=='tc'){
				zskfx=0;
				try {
					if(typeof tc_call === "function") {
						tc_call();
					}
				} catch(e) {}
			}

			if (uid > 0 && re.tan.code=='1'){
				var d = re.tan.data;
				var content = '<div style="font-weight:bold;">'+d.bt+'</div><div style="margin-top:10px;">'+d.nr+'</div><div style="text-align:right;margin-top:10px;">'+d.sj+'</div>';
				layer.confirm(content,{icon:9,area:'530px',title:'重要提醒',closeBtn:false,skin:'jm-class',btn: ['我知道了'],shadeClose:false}, function(index2){
					$.ajax({
						type: "POST",
						url: '/user_main/duxiaoxi',
						data: 'id=' + d.id,
						success: function(re) {
							layer.close(index2);
						}
					});
				});
			}

		}
	});
	return false;
};

//表单验证
function yz(div) {
	var x = 0;
	$("#" + div + " input[required='required']").each(function () {
		if ($(this).val() == "") {
			var msg=$(this).attr('placeholder');
			if(!msg){
				msg=$(this).attr('msg');
			}
			if(msg && msg.length>0){
				layer.msg(msg);
			}
			$(this).addClass('has-error').focus();
			x = 1;
			return false;
		}
		else{
			$(this).removeClass('has-error');
		}
	});
	if (x == 1) {
		return false;
	}
	return true;
}

//登录验证
function islogin(txt){
	if(uid<=0){
		if(typeof txt==="undefined"){
			txt="继续操作";
		}
		var llset=layset;
		llset.icon='7';
		txt="<font color=red>对不起，您需要<a onclick=\"login();return false\" href='/login.htm' title='去登录或注册帐户' target='_blank'>登录本站帐户</a>，才能"+txt+"。</font>";
		llset.yes=function(){
			login();
		};
		layer.alert(txt,llset);
		return false;
	}
	return true;
}

//VIP验证
function isvip(txt){
	if(ishy != 1){
		if(typeof txt==="undefined"){
			txt="无法使用本功能";
		}
		txt="抱歉，您不是本站高级会员或会员已过期，"+txt+"，您可以<a href='/user_vip.htm' target='_blank' title='马上去升级本站高级会员'>升级本站高级会员(最低<font color=red>只需要0.27元一天</font>)</a>";
		layer.alert(txt,layset);
		return false;
	}
	return true;
}


//操作保护
var mmbh={};
function if_mmbh(txt){
	if(!islogin()){return false;}
	layer.closeAll();
	var ok=1;
	$.ajax({
		type: "GET",
		url: "/main/if_mmbh?r=1",
		dataType: "json",
		cache: false,
		async:false,
		success: function (re) {
			if(re.code==-101){//未设置
				ok=0;
				layer.alert('您好，本站为了加强帐户安全，增加操作保护，您还没设置操作保护，设置后才能继续操作此功能！<a href="'+re.url+'" target="_blank" style="color:#f00">立即设置</a>',layset);
				return false;
			}
			else if(re.code==-102){//未解除
				ok=0;
				mmbh.wt=re.wt;
				mmbh.sj=re.sj;
				mmbh.token=re.token;
				mmbh_tc();
				return false;
			}
			else{
				return true;
			}
		}
	});
	return ok==1 ? true : false;
}

//保护弹窗
function mmbh_tc(){
	layer.closeAll();
	var sjx='';
	if(mmbh.sj!="0"){
		sjx='<div><label>认证手机号：</label><span>'+mmbh.sj+'</span></div><div><label>手机验证码：</label><input name="yzm" class="jm-input w100" maxlength="6" type="text" msg="请点击获取短信后输入您收到的验证码" required="required"/><input class="jm-button" value="短信获取" id="btnSendMsg" onclick="return send_sms(1);" type="button"><input class="jm-button bg2" value="语音获取" id="btnSendMsg2" onclick="return send_sms(99);" type="button"><span id="dvCode" style="color:#F00;"></span></div>';
	}
	var html='<div id="mmbh"><form method="post" action="/user_baohu/close_baohu" id="mmbh_form" onsubmit="return close_bh();"><input name="csrf_token" type="hidden" value="'+mmbh.token+'"><div class="notice">您的帐户正在安全保护状态，执行此操作请先解除操作保护，解除后才可以继续操作。<i class="iconfont" tips="czts" title="点击查看操作保护解除说明" id="jjtip"></i></div><div class="baohu"><div><label>您的问题：</label><span>'+mmbh.wt+'</span></div><div><label>您的答案：</label><input name="mmbhda" placeholder="请输入操作保护答案" id="mmbhda" type="text" class="jm-input" required="required"><span><a href="/help/27.htm" target="_blank">忘记答案？</a></span></div><div><label>帐户密码：</label><input name="pass" id="zhmm" type="password" class="jm-input" placeholder="请输入您账户的登录密码" required="required"><span class="userinfo">请输入您账户的<font color="red">登录密码</font>。</span></div>'+sjx+'<div><label>验证码：</label><input id="re_yzm" class="jm-input w100" name="re_yzm" maxlength="4" type="text" required="required" msg="请输入图片验证码"><img id="re_yzmx" title="看不清？点一下换图" src="/xcode" onclick="this.src=\'/xcode?\'+new Date().getTime();" align="absmiddle"></div><div><label></label><input class="jm-button bg3" type="button" id="czbhtj" value="解 除"><span id="bh_shuchu"></span></div><div class="tiptxt czts"><span>1. 为了更好的保障您的帐户域名、资金安全，本站特增加此功能，保护您的帐户安全；<br>2. 本功能解除帐户安全保护，并非是把帐户的操作保护答案给清除了，只是让您帐户在本次登录中无限制操作；<br>3. 帐户保护状态一旦解除，那么您本次登录可执行任何关键操作，如：转出域名，Push域名，提现，等等关键操作；<br>4. 解除保护后，帐户的任何操作系统将默认为是您本人操作，引起的一切问题您自行承担；<br>5. 本次解除后，可手动开启帐户保护状态；<br>6. 帐户安全保护状态每次帐户退出或重新登录自动开启，解除需每次手动解除保护；</span></div></div></foem></div>';
	layer.open({
		type: 1,
		skin: 'jm-class',
		shadeClose: true,
		title: '操作保护',
		area: '600px', //宽高
		content: html,
		success: function () {
			$(".jm-class .cancel-btn").click(function () {
				layer.closeAll();
			});
			$("#mmbh #czbhtj").click(function () {
				close_bh();
			});

			$("#mmbh input").keyup(function(e) {
				if (e.keyCode  == 13) {
					close_bh();
				}
			});
		}
	});
	return false;
}

var timer_mmbh = null;
var leftsecond_mmbh = 60; //倒计时
var msg_mmbh = "";

//发送短信
function send_sms(t0) {
	leftsecond_mmbh = 60;
	$("#btnSendMsg,#btnSendMsg2").hide();
	var d=gettong('dvCode','/user_baohu/send_sms?fs='+t0,'',1);
	if(d.code>0){
		$('#dvCode').html('<font color=#0000ff>'+d.msg+'</font>');
		clearInterval(timer_mmbh);
		timer_mmbh = setInterval(setLeftTime_mmbh, 1000, "1");
	}
	else{
		$('#dvCode').html(d.msg);
		$("#btnSendMsg,#btnSendMsg2").show();
	}
}

//倒计时
function setLeftTime_mmbh() {
	var second = Math.floor(leftsecond_mmbh);
	$("#dvCode").html('<span>需要等待（'+msg_mmbh + second + "）秒后才能重新发送</span>");
	leftsecond_mmbh--;
	if (leftsecond_mmbh < 1) {
		$("#dvCode").html("");
		clearInterval(timer_mmbh);
		$("#btnSendMsg,#btnSendMsg2").show();
		return false;
	}
}

//解除保护
function close_bh(){
	if(!yz("mmbh")) {
		return false;
	}
	//var i=layer.confirm('您确认此操作？',{icon: 3, skin:'jm-class'},function (index) {
		var ddurl=$('#mmbh_form').attr('action');
		var ddnn=$('#mmbh_form').serialize();
		$.ajax({
			cache: true,
			type: "POST",
			url:ddurl,
			data:ddnn,
			cache:false,
			timeout:120000,
			error: function() {
				$("#bh_shuchu").html('加载超时，请重试一次，如重试不行，请联系本站客服！');
			},
			success: function(d) {
				if(d.code>0){
					layer.closeAll();
					layer.msg(d.msg);
				}else{
					$('#re_yzm').val("");
					$('#re_yzmx').click();
					//layer.close(i);
					$("#bh_shuchu").html('<font color=red>'+d.msg+'</font>');
				}
			}
		});
		
	//});
	return false;
}

var getxx;
//查询详细信息
function get_xx(ym){
	layer.closeAll();
	layer.load(3);
	$.ajax({
		url: '/hao?ym='+ym+'&fs=1',
		cache: false,
		success: function (d) {
			layer.closeAll();
			var zt=d.substr(0,1);
			d=d.substr(1);
			
			getxx=layer.open({
				type: 1,
				skin: 'jm-class',
				title: '<div id="xx_title">提示</div>',
				shadeClose: true,
				area: zt=='1' ? '1000px' : '',
				content: d,
				move: '#xx_title',
				success: function(layero, index) {
					//layer.iframeAuto(index);
				}
			});
		},
		error:function () {
			layer.closeAll();
			layer.msg('请求失败,请重试!');
		},
		
	});
	return false;
}

//通用请求
function POSTtong(form,scid,call){
	call = call || "";
	var ddurl=$(form).attr('action');
	var ddnn=$(form).serialize();
	$.ajax({
		cache: true,
		type: "POST",
		url:ddurl,
		data:ddnn,
		cache:false,
		timeout:120000,
		error: function(request) {
			$("#"+scid).html('加载超时，请重试一次，如重试不行，请联系本站客服！');
		},
		success: function(data) {
			if($.isFunction(call)) {
				call(scid, data);
			}
			else{
				$("#"+scid).html(data);
			}
		}
	});
	return false
}
function gettong(id,url,load,refs){
	var old=$('#'+id).html();
	if(load!='' && load != undefined){
		if(load=='.'){load='';}
		$('#'+id).html("<img src='"+ossurl+"/img/lo.gif'>"+load).show();
	}
	var rex='';
	$.ajax({
		type: "get",
		cache:false,
		async: refs==1 ? false : true,
		url: url,
		timeout: 60000,
		error:function(){},
		success:function(re){
			if(refs==1){
				rex=re;
			}
			else{
				if(re.code<=0){
					if(re.code==-100){
						islogin();
					}else{
						layer.msg(re.msg);
						$('#'+id).html(old);
					}
				}else{
					$('#'+id).html(re.msg);
				}
			}
		}
	});
	if(refs==1){
		return rex;
	}
	else{
		return false;
	}
}

$(function () {
	var navList = [];
	var num = 0;
	layer.config({
	  shadeClose:1,
	});
	$('body').append('<div class="bg_shade"></div>');
	$('.bg_shade').css('height',$(document).height()-159);

	$(".common-search-list li").click(function () {
		var _dom = $(".common-search-list li");
		_dom.removeClass("search-active");
		$(this).addClass("search-active");
		$('.common-search-input').attr("placeholder",$(this).attr('ph'));
	});
		
	$('.common-search-button').click(function () {
		var key= $('.common-search-input').val();
		if(key==""){
			layer.msg('请输入要查询的域名!'); 
			return false;
		}
		key=$.trim(key.toLowerCase());
		$('.common-search-input').val(key);
		var url= ($('.search-active').attr('data')=='1' ? "/hao/" : "/whois/") + key;
		if(!isym(key)){
			url='/reg/c?ym='+key;
		}
		window.open(url);
		return false;
	});
	$('.common-search-input').keypress(function (event) {
		if (event.keyCode == 13) {
			$('.common-search-button').click();
			return false;
		}
	});

	// 导航
	function navline(){
		if($('.common-topbar-nav-list li a.nav-on').length>0){
			var ton=$('.common-topbar-nav-list .nav-on').parent('li');
			var left=ton.position().left+20;
			$('.header-nav-hover-line').css('left',left + 'px').show().css('width',parseInt(ton.width())+'px');
		}else {
			$('.header-nav-hover-line').hide();
		}
	}
	navline();
	var qcloud = {};
	$('[data-nav]').hover(function (event) {
		var _this = $(this);
		var _index = $(this).attr("data-nav");
		var left = 20;
		if (_index == "nav_sy") {
			left = 0;
		} else {
			clearTimeout(qcloud[_index + '_timer']);
			qcloud[_index + '_timer'] = setTimeout(function () {
				 $(".bg_shade").show();
				$("#" + _index).stop(true, true).slideDown(200);
			}, 150);
		}
		var navt=$('.common-topbar-nav-list li[data-nav='+_index+']');
		$('.header-nav-hover-line').css('left', navt.position().left + left + 'px').css('width', parseInt(navt.width()) + 'px').fadeIn();
	}, function () {
		var _this = $(this);
		var _index = $(this).attr("data-nav");
		clearTimeout(qcloud[_index + '_timer']);
		qcloud[_index + '_timer'] = setTimeout(function () {
			$("#" + _index).stop(true, true).slideUp(200);
			$(".bg_shade").hide();
		}, 150);
		navline();
	});

	$(".common-nav-r").mouseenter(function (event) {
		$(".common-user-nav,.bg_shade").show();
	}).mouseleave(function (event) {
		$(".common-user-nav,.bg_shade").hide();
	});

	$(".foot-contact ul li").mouseenter(function () {
		$(".foot-contact ol img").eq($(this).index()).show()
	}).mouseleave(function () {
		$(".foot-contact ol img").eq($(this).index()).hide()
	});
	
	// 客服弹窗
	var _height = $(window).height();
	var _url = $("#kfjs").attr("src");
	var a_buxian = 0;
	var a_buxian_s = 0;

	// 获取地址上qq号码与电话号码参数
	function getparam(urlStr, paras) {
		var url = urlStr;
		var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
		var paraObj = {},i,j;
		for (i = 0; j = paraString[i]; i++) {
			paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
		}
		var returnValue = paraObj[paras.toLowerCase()];
		if (typeof(returnValue) === "undefined") {
			return "";
		} else {
			return returnValue;
		}
	}

	var kfitem='<div class="item kf"><i class="iconfont">&#xe76f;</i><div class="content content3"><div class="main clearfix"><em class="sjx"></em><div class="fl"></div><div class="fr right"><p class="kftxt">您的专属客户经理</p><span>昵称：<em class="nickname">加载中...</em></span><span>Q Q：<em class="k-qq">加载中...</em></span><span>电话：<em class="k-call">加载中...</em></span></div></div></div></div>';
	
	var dlitem=isdl!=1 ? '<div class="item"><i class="iconfont">&#xe61a;</i><a href="/agent.htm" target="_blank" class="content text"><div class="main"><em class="sjx"></em>代理申请：超值礼遇 点我查看详情</div></a></div>' : '';
	
	$('body').append('<div id="kfnew">'+kfitem+'<div class="item"><i class="iconfont icon2">&#xe6b9;</i><a target="_blank" class="content content2" href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAxNzIxMV8xNzU2NTBfNDAwOTk3Mjk5Nl8"><div class="main"><span>在线客服（9:00-22:30）</span><strong>400-997-2996</strong><em class="sjx"></em></div></a></div><div class="item"><i class="iconfont">&#xe68e;</i><a href="/user_wt_add.htm" target="_blank" class="content text"><div class="main"><em class="sjx"></em>聚名不是完美的，我们渴望您的建议</div></a></div>'+dlitem+'<div class="item returnTop"><i class="iconfont">&#xe6bb;</i></div></div>');

	$('#kfnew').mouseenter(function (){
		if(zskfx==0){
			$.ajax({
				url: '/user_zh/kefu',
				dataType: 'json',
				type: 'post',
				error: function () {
					$("#kfnew .kf").hide();
				},
				success: function (re) {
					if (re.code > 0) {
						$('#kfnew .kftxt').text(re.code==1 ? '您的专属客户经理' : '客户经理推荐')
						var data=re.data;
						$(".nickname").text(data.xm);
						$(".k-qq").html('<a title="点击咨询" href="http://wpa.qq.com/msgrd?v=3&uin='+ data.qq +'&site=qq&menu=yes" target="_blank">'+data.qq+'</a>');
						$(".k-call").text(data.sj);
						$('#kfnew .content3 .fl').html('<img src="'+ossurl+'/img/kf/'+data.qq+'.jpg" class="ewm" alt="扫码添加客服微信" title="扫码添加客服微信">');
						$("#kfnew .kf").show();
					} else {
						$("#kfnew .kf").hide();
					}
				}
			})
		}
		zskfx=1;
	});
	
	
	var _dom = $(".returnTop");
	// 监听页面滚动隐藏按钮
	$(window).scroll(function () {
		if ($(window).scrollTop() > _height) {
			_dom.fadeIn();
		} else {
			_dom.fadeOut();
		}
	});

	// 返回顶部
	_dom.click(function () {
		$('body,html').animate({scrollTop: 0}, 400);
	});

	dlzt();
	
	// 登陆
	$(document).on("click", ".login" , function() {
		login();
	});
	
	//退出
	$(document).on("click", ".logout" , function() {
		$.ajax({
			url: '/user_zh/logout',
			dataType: 'json',
			success: function (res) {
				dlzt('tc');
				layer.msg(res.msg);
			}
		});
		
	});

	//tips
	$('body').on('click','[tips]',function(){
		var d=$(this).attr("tips");
		var t=$(this).attr("title").replace('点击查看','');
		var b=$('.'+d+' span').html();
		layer.alert(b,{title:t,area:'600px',shadeClose:true,skin: 'jm-class'});
	});

	//tips
	$('body').on('mouseenter', '*[tip]', function() {
		var othis = $(this);
		var tips = othis.attr('tip'),
			offset = othis.attr('offset'),
			offtop = othis.attr('top'),
			color = othis.attr('color'),
			direction = othis.attr('wz');
			maxWidth = othis.attr('mw');
		var tset = 1;
		if (direction && direction.length > 0) {
			tset = parseInt(direction);
		}
		if (direction && color && color.length > 0 && direction.length > 0) {
			tset = [direction, color];
		}
		var set={
			tips: tset,
			time: -1,
			anim:5,
			success: function(layero, index) {
				if (offset) {
					layero.css('margin-left', offset + 'px');
				}
				if (offtop) {
					layero.css('margin-top', offtop + 'px');
				}
			}
		};
		if(maxWidth){
			set.maxWidth=maxWidth;
		}
		var index = layer.tips(tips, this, set);
		othis.data('index', index);
	}).on('mouseleave', '*[tip]', function() {
		layer.close($(this).data('index'));
	});

	$('form').on('change','input.has-error',function(){
		$(this).removeClass('has-error');
	});

	$("body").on("keyup", "#pageset", function (){
		$(this).val($(this).val().replace(/[^0-9]/g,''));
	});
})
